<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.partner.prepay.user.form.User"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.partner.prepay.role.form.Role"%>
<%@page import="com.partner.prepay.role.form.Function"%>


<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	/**获取密匙*/
	String userKey = (String) request.getParameter("key");
	if (null == userKey || "".equals(userKey)) {
		/**如果没有获取到则在attribute中获取*/
		userKey = request.getAttribute("key") + "";
	}
	/**定义当前用户对象*/
	User user = null;
	/**定义当前用户角色*/
	Role role = null;
	/**定义当前用户权限*/
	Map<String, Function> functions = null;
	/**如果获取到密匙，则执行赋值操作*/
	if (null != userKey && !"".equals(userKey)
			&& !"null".equals(userKey)) {
		/**通过密匙获取用户 */
		user = (com.partner.prepay.user.form.User) session
				.getAttribute(userKey);
		if (null != user) {
			//设置角色
			role = user.getRole();
			if (null != role) {
				//设置权限
				functions = user.getFunctions();
			}
		}
	}

	//如果检测为空则设置默认值
	if (user == null) {
		user = new com.partner.prepay.user.form.User("请重新登录", "",
				"请重新登录");
	}
	if (role == null) {
		role = new Role();
	}
	if (functions == null) {
		functions = new LinkedHashMap<String, Function>();

	}
%>

